package 补充.输入输出操作.文件操作;

import java.io.File;
import java.io.FilenameFilter;

public class File文件过滤器 {
    public static void main(String[] args) {
        FilenameFilter filer = new FilenameFilter() {
            public boolean accept(File dir, String name) {
                File f = new File(dir,name);
                if (f.isFile()&&name.indexOf(".lnk")!=-1) {
                    return true;
                }else {
                    return false;
                }

            }
        };
        String[] list =new File("C:\\Users\\26957\\Desktop\\桌面").list(filer);
        for (int i = 0; i < list.length; i++) {
            System.out.println(list[i]);
        }
    }
}
